set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

# 定义工具链根目录路径
set(TOOLCHAIN_ROOT ${PROJECT_SOURCE_DIR}/toolchains/aarch64)

set(CMAKE_C_COMPILER   ${TOOLCHAIN_ROOT}/bin/aarch64-buildroot-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_ROOT}/bin/aarch64-buildroot-linux-gnu-g++)
set(CMAKE_STRIP        ${TOOLCHAIN_ROOT}/bin/aarch64-buildroot-linux-gnu-strip)
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT}/aarch64-buildroot-linux-gnu/sysroot)
set(CMAKE_SYSROOT ${TOOLCHAIN_ROOT}/aarch64-buildroot-linux-gnu/sysroot)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# 包含目录设置
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third_party/include)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third_party/include/eudev)

# 链接目录设置
link_directories(${PROJECT_SOURCE_DIR}/third_party/lib/aarch64)

include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
# 平台特定的编译标志
set(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -march=armv8-a+crc+crypto")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMMON_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_COMMON_FLAGS}")

string(TOLOWER ${CMAKE_SYSTEM_NAME} CW_SYSTEM_NAME)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CW_SYSTEM_PROCESSOR)